package StudyCode.summary.myfile;

import java.io.IOException;
import java.nio.file.*;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class FilterCustom {
	public static void main(String[] args) {
		DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {

			public boolean accept(Path file) throws IOException {
				return (Files.isHidden(file));
			}
		};

		Path directory = Paths.get("C:/Windows");
		try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(directory, filter)) {
			for (Path file : directoryStream) {
				System.out.println(file.getFileName());
			}
		} catch (IOException | DirectoryIteratorException ex) {
			ex.printStackTrace();
		}

	}
}
